<?php

namespace App\Models;

use App\Common\Traits\HasAttachments;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * 商品活动标签
 * Class Label
 * @package App\Models
 */
class CommodityLabel extends Base
{
    use HasAttachments, SoftDeletes;

    protected static function boot()
    {
        static::addGlobalScope('orderBySortIdDesc', function (Builder $builder) {
            $builder->orderBy('sort_id', 'ASC');
        });

        parent::boot(); // Base 的创建时间排序在后面, 优先 sort_id 排序
    }
}
